package net.cityside.dp.rp;

import java.awt.print.PrinterException;

import javax.swing.JEditorPane;

public class RichTextPrinter {

	public static final String CONTENT_TYPE_HTML = "text/html";
	public static final String CONTENT_TYPE_PLAIN = "text/plain";

	private JEditorPane editorPane;

	public RichTextPrinter() {
		editorPane = new JEditorPane();
		editorPane.setContentType(CONTENT_TYPE_HTML);
	}

	public RichTextPrinter(String contentType) {
		editorPane = new JEditorPane();
		editorPane.setContentType(contentType);
	}

	public void printAndWait(String text) throws PrinterException {
		editorPane.setText(text);
		editorPane.print();
	}
}
